-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
implement @expect
builtin
#19658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement @expect
builtin
#19658
Conversation
Are you saying that LLVM's |
Expect with probability seems to affect |
When there is no expected value nor probability, wouldn't a name like |
For purposes of consistency with C (compiler |
I don't want likely as it implies an unlikely. Note that the only real purpose of this builtin is the unlikely version, and unlikely is a bit ugly imo. I will change it up to accept a second field for true or false instead and keep expect as per @kprotty suggestion when we talked about it. |
Since the user can implement a likely or unlikely pretty easily themselves when a second field is added:
I think this would be the best solution. Thanks! :) |
Should |
Thought about that yesterday, but I think making |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a nice sugary @expect(operand: anytype, expected: anytype)
and add a check for @typeOf(operand) == @typeOf(expected)
?
Reverted in 9be8a90. I would like a chance to review this please. |
This reverts commit a7de02e. This did not implement the accepted proposal, and I did not sign off on the changes. I would like a chance to review this, please.
This reverts commit a7de02e. This did not implement the accepted proposal, and I did not sign off on the changes. I would like a chance to review this, please.
closes #489
Why
@expect
takes a bool:@expect
affects branching codegen and you can only branch on a bool.unreachable
with respect to the optimizer.Why
@expect
doesn't have a probability: